package com.team.cloudsharing.ultis;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class CastArrayList {
	public static <E> List<E> castCollection(Collection<?> collection,
			Class<? extends E> clazz) {
		List<E> result = new ArrayList<E>(collection.size());

		for (Object current : collection) {
			result.add(clazz.cast(current));
		}
		return result;
	}
	public static <E> Object castObject(Object object,
			Class<? extends E> clazz) {
		Object result = clazz.cast(object);
		return result;
	}
}
